later use convenient, choose a short name, and then save
C Turn on the Cygwin, enter the CD $NDK, and if you output the/CYGDRIVE/E/ANDROID-NDK-R5 information configured above, the environment variable setting is successful.
4. Use NDK to compile the program
A Now we use the installed
current Cygwin version and running state, if the status is OK, then Cygwin run normal.
Then enter gcc–version,g++--version,make–version,gdb–version to test, if all print out version information and some description information, then Cygwin installation success!
3. Configure NDK Environment variables
A First find the Cygwin installation directory, find a home\
b Open the Bash_profile file and add ndk=/c
the SRC item is the source code. This is unnecessary.
11. Test whether cygwin has been installed.
Run cygwin. In the displayed command line window, enter the cygcheck-C cygwin command to print the current cygwin version and running status. If the status is OK, cygwin runs normally.
Enter gcc-V, G ++ -- version, make-version, and GDB-version in sequence for testing. (note the space and-) if both print the published information and some description information, we are very happy to tell you that
=/cygdrive/Ndk=/cygdrive/e/android-ndk-r6Export NDKThe NDK name is random, for the convenience of later use, choose a short name, and then saveJune 7, 2013: It must be noted here, the input can not have extra symbols, it is best not to copy and paste, I tried many times, direct copy paste absolutely to error. When opening that file, it's best not to use Notepad,
interface when creating new project Include C++ Support . Checking it will create a default C + + Java-Mixed demo program. Let's take a look at this official standard demo.
Before you start, it's a good idea to download the NDK first, see NDK development from getting started to giving up (one: Getting Started with the basic process), which is to download or select the correct path in the project s
enter gcc–version,g++--version,make–version,gdb–version for testing, and if you print out the version information and some descriptive information, the Cygwin installation is successful!3. Configure NDK Environment variablesAFirst find the Cygwin installation directory, find a home\b Open a. bash_profile file, add ndk=/cygdrive/Ndk=/cygdrive/e/android-
transplantation. The C/C ++ library can be easily used on other embedded platforms. Especially some apps with high performance requirements, such as mobile games, are generally developed using the Native language.
3. Windows environment Configuration(1) download NDK Development Kit: From the ndk-7, Google has improved the ndk operation, do not need to use cygwi
environment variable is correctly configured.
Next, locate the path in the hard drive of the src folder in the project:
Open MainActivity in the project and add the following code:
Public native String hello (); // defines the method name static {System. loadLibrary ("testJni") in. so; // defines the name of the generated. so}You need to write this information in advance. in so Activity, the method name defined in the header file will be automatica
1. Install the ndk SDK under cygwin by referring to the documentation provided by the SDK ndk. For the subsequent steps, we recommend that you configure the respective root directory and the tools directory under the SDK to the path of win. Make sure that you can easily access ADB, ndk-build, and ndk-GDB in cygwin.
Ch
Android ndk Overview
Introduction:
Android SDK is a set of tools that allow Android Application developers to compile and embed application packages in the local source code using C or C ++ source files.
Important:
Android ndk can only be used for Android 1.5 or later versions.
1.Android ndkPurpose:
The android virtual machine allows your application source code to be locally implemented through JNI calls.
compile a simple program, we choose the NDK's own example Hello-jni, I am located in E:\android-ndk-r5\samples\hello-jni (depending on your specific installation location),b Run Cygwin, enter the command Cd/cygdrive/e/android-ndk-r5/samples/hello-jni, and go to the E:\android-ndk-r5\samples\hello-jni directory.CInput $NDK
1. Development Environment Configuration
As we all know, it is difficult to start with everything. configuring a development environment is the most basic and necessary step for all development projects.
All software and development platforms used: win7 + netbeans + VMware + Ubuntu + ndk + Android SDK
First of all, in win7 platform to configure the development of Android environment, detailed reference blog: http://blog.csdn.net/tianshuai11/article/de
Start of building the Android NDK environment NDK HelloWorld
ADT Plugin: used to manage the Android SDK and related development toolsNDK plug-in: used to develop Android NDK plug-ins. If the ADT version is above 20, you can install the NDK plug-in. In addition, the NDK integ
bin directory to the system environment variables
For example, my path is: C: \ java \ android-ndk-r7b and C: \ java \ cygwin \ bin
After the environment is configured, you can start encoding.
1. Create an android Project
2. Add a folder named jni under the project directory (required)
3. Create Your. c file (my name is Hello. c) in the jni folder)
4. Create a file named Android. mk in the jni folder.
Add
normally.Then enter gcc–version,g++--version,make–version,gdb–version for testing, and if you print out the version information and some descriptive information, the Cygwin installation is successful!3. Configure NDK Environment variablesAFirst find the Cygwin installation directory, find a home\b Open a. bash_profile file, add ndk=/cygdrive/Ndk=/cygdrive/e/andr
that your cygwin installation is complete!4. Configure NDK Environment Variables1. First find the installation directory of cygwin and find a home \ There are no Trojans in the home folder. Solution: First open the environment variable, delete the HOME variable in the user variable, re-run cygwin, and automatically generate related files in the directory.2. Open the bash_profile file and add NDK =/cygdrive
For self-developed ndk, it should be a little excited to compile and run Hello-JNI.
(Ubuntu environment) The establishment of the ndk development environment is easy to stop, but there are still several days of prompts:
1. In the C/C ++ environment of Eclipse, it is best to manually install the CDT plug-in,
(See my other note. Eclipse CDT security guide.)
Help --> install new sofeware is too difficult t
Target
Android plug-in for Eclipse (ADT) now supports NDK-based application development. It can automatically generate project and component files and code stubs, and can be integrated into the entire Android Application Development (build the native library, copy the Library to the corresponding JNI folder in the project, package the application, and generate the final APK with the NDK code ). This article
. Test whether cygwin has been installed.
Run cygwin and enter cygcheck in the pop-up command line window.The-C cygwin command prints the current cygwin version and running status. If the status is OK, cygwin runs normally.
Then input gcc-version, G ++ -- version, make-version, and GDB-version in sequence for testing. If both print the published version information and some description information, I am very happy to tell you, your cygwin installation is complete!
3. Configure
1, the use of Ndk-buildAndroid NDKR4 introduces a new, small shell script Ndk-build to simplify source code compilation.The file is located in the NDK root directory, and after entering your project root directory or subdirectory, you can use it at the command line. For example:CD $PROJECT$NDK/
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.